<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>这是标题dom</h1>
		<p id= "firstp" onclick="func02()" onclick="func03()">这是第一个段落</p>
		<p>这是第二个段落</p>
		<p class = "tp" name = "test">这是第三个段落</p>
		<script>
			//根据id获取
			function func01(){
				var docel = document.getElementById("firstp")
				docel.style.color = "red"
				docel.innerHTML ="修改后的p段落"
					
			}
			//根据标签获取
			var el1 = document.getElementsByTagName("p");
			// el1[0].onclick = func02
			// el1[0].onclick = func03
			el1[0].innerHTML = "修改第一个段落"
			console.log(el1);
			
			var el2 = document.getElementsByClassName("tp");
			el2[0].style.color = "green";
			el2[0].addEventListener("click",func02)
			el2[0].addEventListener("click", func03)
			// console.log(el2);
			console.log(el2[0].getAttribute('name'))
			function func02(){
				console.log("添加事件成功")
			}
			function func03(){
				console.log("func03添加事件成功")
			}
			
		</script>
	</body>
</html>
